package com.example.leonard.controller;

import com.example.leonard.core.mq.provider.DirectProvider;
import com.example.leonard.core.mq.provider.FanoutProvider;
import com.example.leonard.core.mq.provider.HeadProvider;
import com.example.leonard.core.mq.provider.TopicProvider;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value = "/mq")
@Api(value = "rabbit测试")
public class RabbitMqController {
    @Autowired
    private HeadProvider headProvider;
    @Autowired
    private TopicProvider topicProvider;
    @Autowired
    private FanoutProvider fanoutProvider;
    @Autowired
    private DirectProvider directProvider;

    @RequestMapping(value = "/header", method = RequestMethod.GET)
    @ApiOperation(value = "mq header模式")
    public void header() {
        headProvider.sendMessage();
    }

    @RequestMapping(value = "/topic", method = RequestMethod.GET)
    @ApiOperation(value = "mq topic模式")
    public void topic() {
        topicProvider.sendMessage();
    }

    @RequestMapping(value = "/fanout", method = RequestMethod.GET)
    @ApiOperation(value = "mq fanout模式")
    public void fanout() {
        fanoutProvider.sendMessage();
    }

    @RequestMapping(value = "/direct", method = RequestMethod.GET)
    @ApiOperation(value = "mq direct模式")
    public void direct() {
        directProvider.sendMessage();
    }
}
